<template>
  <h1>El-单选组件</h1>
  <el-radio-group v-model="gender">
    <el-radio label="男" value="1"></el-radio>
    <el-radio label="女" value="0"></el-radio>
  </el-radio-group>
  <h4>您选择的性别是：{{gender}}</h4>
  <hr>
  <el-radio-group v-model="edu">
    <el-radio-button label="专科" value="zk"></el-radio-button>
    <el-radio-button label="本科" value="bk"></el-radio-button>
    <el-radio-button label="硕士" value="ss"></el-radio-button>
    <el-radio-button label="博士" value="bs"></el-radio-button>
  </el-radio-group>
  <h4>您选择的学历是：{{edu}}</h4>
  <hr>
  <el-radio-group v-model="pri">
    <el-radio-button v-for="p in arr" :label="p.title" :value="p.price"></el-radio-button>
  </el-radio-group>
  <h4>您选择的酒价为：{{pri}}元</h4>
</template>

<script setup>
import {ref} from "vue";

//定义变量用来保护用户选择的性别
const gender=ref('');
//定义变量用来保护用户选择的学历
const edu=ref('ss');
//当用户选中茅台选项时，显示：您选择的酒价为1000元
const arr=ref([
  {title:'五粮液',price:500},
  {title:'茅台',price:1000},
  {title:'剑南春',price:2000},
  {title:'郎酒',price:3000}
]);
//定义变量用来保护用户选择的选项值
const pri=ref(1000);
</script>

<style scoped>

</style>